import java.lang.reflect.Proxy;

public class Court {
    public static void main(String[] args){
         LawyerProxy lawyerProxy=new LawyerProxy(new ZhangSan());
         // 参数1: 接口（Speaker）的加载器
        // 参数2: 需要代理的的接口
        // 参数3: 代理类对象，即实现了invocationHandler接口的对象
         Speaker speaker1= (Speaker) Proxy.newProxyInstance(Speaker.class.getClassLoader(),new Class[]{Speaker.class},lawyerProxy);
         speaker1.speak();
    }
}













